package com.lk.security.controller;

import com.wf.captcha.utils.CaptchaUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/** @author likang */
@Controller
public class CustomLoginController {

  public static final String SESSION_KEY = "SESSION_KEY_IMAGE_CODE";
  private static final Logger logger = LoggerFactory.getLogger(CustomLoginController.class);

  @GetMapping("/login/page")
  public String toLogin() {
    return "login";
  }

  /** 获取图形验证码 */
  @GetMapping("/code/image")
  public void imageCode(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    CaptchaUtil.out(request, response);
  }
}
